import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/views/login/index.vue'
import Home from '@/views/home/index.vue'
import My from '@/views/my/index.vue'
import Layout from '@/views/layout/index.vue'
import Qa from '@/views/qa/index.vue'
import Video from '@/views/video/index.vue'
import Search from '@/views/search/index.vue'
import Article from '@/views/article/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: Home
      },
      {
        path: '/qa',
        name: 'qa',
        component: Qa
      },
      {
        path: '/video',
        name: 'video',
        component: Video
      },
      {
        path: '/my',
        name: 'my',
        component: My
      },
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: Search
  },
  {
    path: '/article/:articleId',
    name: 'article',
    component: Article,
    props: true // 开启props传参
  },

]

const router = new VueRouter({
  routes
})

export default router
